/**
 * Project Name:Micro-Services-Codec-Msgpack
 * File Name   :Main5.java
 * Package Name:com.micro.services.codec.msgpack
 * Date:2015-9-6下午3:22:07
 * Copyright (c) 2015, http://my.oschina.net/httpssl All Rights Reserved.
 *
 */
/**
 *  {{Code Template Comments Files}}
 */

package com.micro.services.codec.msgpack;

import java.util.ArrayList;
import java.util.List;

import org.msgpack.MessagePack;
import org.msgpack.type.Value;
import org.msgpack.unpacker.Converter;

import static org.msgpack.template.Templates.tList;
import static org.msgpack.template.Templates.tMap;
import static org.msgpack.template.Templates.TString;
/**
 * ClassName:Main5 <br/>
 * Function :TODO ADD FUNCTION. <br/>
 * Reason :TODO ADD REASON. <br/>
 * Date :2015-9-6 下午3:22:07 <br/>
 * 
 * @author :http://my.oschina.net/httpssl
 * @email :491835898@QQ.COM
 * @since :JDK 1.7
 * @see
 */
@SuppressWarnings("all")
public class Main5
{
	public static void main(String[] args) throws Exception {
		// Create serialize objects.
		List<String> src = new ArrayList<String>();
		src.add("msgpack");
		src.add("kumofs");
		src.add("viver");

		MessagePack msgpack = new MessagePack();
		// Serialize
		byte[] raw = msgpack.write(src);

		// Deserialize directly using a template
		List<String> dst1 = msgpack.read(raw, tList(TString));

		// Or, Deserialze to Value then convert type.
		Value dynamic = msgpack.read(raw);
		List<String> dst2 = new Converter(dynamic).read(tList(TString));

	}
}
